﻿using GameServer.Model;
using Summer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameServer.Mgr
{
    public class SpawnManager
    {
        public List<Spawner> Rules = new List<Spawner>();
        public Space Space { get; set; }
        public void Init(Space space)
        {
            Space = space;
            var rules=DataManager.Instance.MonsterSpawns.Values.Where(r => r.SpaceId == space.Id);
            foreach (var rule in rules)
            {
                Rules.Add(new Spawner(rule, space));
            }
        }

        public void Update()
        {
            foreach (var rule in Rules)
            {
                rule.Update();
            }
        }
    }
}
